import java.io.Serializable;

/**
 * 
 * @author Group 03, NETWORK COMUNICATION COMPONENT, SOFTWARE ENGINEERING I,
 *         2012-2013.
 * 
 *         Messages sent from a clients to the server. A message contains a type
 *         (enum), a payload (String), and the client's nickname (String).
 * 
 */

public class MessageToServer implements ServerSideMessage, Serializable {

	private Type typeOfMessage;
	private String payload;
	private String clientsNickname;

	public MessageToServer(Type typeOfMessage, String payload,
			String clientsNickname) {
		this.typeOfMessage = typeOfMessage;
		this.payload = payload;
		this.clientsNickname = clientsNickname;
	}

	/**
	 * Gets the type of the message.
	 * 
	 * @return type of the message.
	 */
	@Override
	public Type getType() {
		return typeOfMessage;
	}

	/**
	 * Gets the payload of the message.
	 * 
	 * @return payload.
	 */
	@Override
	public String getPayload() {
		return payload;
	}

	/**
	 * Gets the sender of the message.
	 * 
	 * @return nickname of the sender.
	 */
	@Override
	public String getClientNickname() {
		return clientsNickname;
	}
}
